package com.nzx.business.demo.task;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 功能描述：业务定时器
 *
 * @author nzx
 * @date 2021/11/14 23:22:14
 */
@Slf4j
@Component
@Configuration
@EnableScheduling
public class DemoTask {

    /**
     * 每隔5秒执行一次
     * */
    //@Scheduled(cron = "0/5 * * * * *")
    public void task(){

        log.info(">>>> 定时器打印=[{}]", LocalDateTime.now());
    }

    /**
     * 每隔5秒执行一次
     * */
    //@Scheduled(cron = "0/15 * * * * *")
    public void task2(){

        log.info(">>>> 定时器打印《《《《《=[{}]", LocalDateTime.now());
    }
}
